package com.jiuqi.captcha.controller;

import com.jiuqi.captcha.utils.CaptchaUtil;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;
import java.util.Base64;

@Controller
public class IndexController {

//    @GetMapping("/")
//    public String index(HttpSession session, Model model) throws IOException {
//        byte[] captchaImageBytes = CaptchaUtil.generateCaptchaImage(session);
//        String captchaImageBase64String = Base64.getEncoder().encodeToString(captchaImageBytes);
//        String captchaText = session.getAttribute("captchaText").toString();
//        model.addAttribute("captchaImage", captchaImageBase64String);
//        model.addAttribute("captchaText", captchaText);
//        return "index";
//    }
}
